import datetime


now = datetime.datetime.now()
today = datetime.date.today()
tomorrow = datetime.timedelta(days = 1)
birthday = datetime.date(1990, 1, 1)

t1 = datetime.timedelta(weeks=1, days=2, hours=1, seconds=33)
t2 = datetime.timedelta(weeks=2, days=1, hours=2, seconds=33)

time_now = now.strftime("%H:%M:%S")
time_now_2 = today.strftime("%Y-%m-%d %H:%M:%S")


# get current date and time
print(now)
print(type(now))


# get current date
print(today)
print(type(today))


# date object to represent a date
# expected result: 2019-02-04
print(birthday)


# difference between two dates and times
print(f'time difference is {t2 - t1}')


# format date using strftime()
print(time_now)
print(time_now_2)


# arithmetic with timedelta
print(f'tomorrow is {now + tomorrow}')


# get date after offset day_delta
def get_date(day_delta=1):
    now = datetime.date.today()
    try:
        time_delta = datetime.timedelta(days = day_delta)
    except OverflowError as e:
        print(f'e')
    return now + time_delta


# test function get_date
print(get_date(-9999))